<template>
  <div class="UserInfo">
    <el-dropdown>
      <div class="box">
        <el-avatar
          :size="30"
          src="https://cube.elemecdn.com/3/7c/3ea6beec64369c2642b92c6726f1epng.png"
        />
        <span>{{ name }}</span>
      </div>
      <template #dropdown>
        <el-dropdown-menu>
          <el-dropdown-item>
            <circle-close style="width: 14px; height: 14px" />
            <span>退出登录</span>
          </el-dropdown-item>
        </el-dropdown-menu>
      </template>
    </el-dropdown>
  </div>
</template>

<script lang="ts">
import { computed, defineComponent } from 'vue'
import { useStore } from '@/store'
export default defineComponent({
  setup() {
    const store = useStore()
    const name = computed(() => store.state.login.userInfo.name)
    return { name }
  }
})
</script>

<style scoped lang="less">
.UserInfo {
  .box {
    display: flex;
    align-items: center;
    span {
      margin-left: 10px;
      font-weight: bold;
      font-size: 16px;
    }
  }
}
</style>
